from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from . import models
from lib.django.admin import ModelAdmin


@admin.register(models.AMTag)
class AMTagAdmin(ModelAdmin):
    list_display = ['id', 'name', 'description', 'created_at']
    list_display_links = ['id', 'name']
    search_fields = ['name', 'description']

@admin.register(models.AuditManagement)
class AuditManagementAdmin(ModelAdmin):
    list_display = ['id', 'content_type', 'object_id', 'auditor', 'status', 'updated_at']
    list_display_links = ['id']
    list_select_related = ['content_type', 'auditor']
    list_filter = ['status', 'content_type']
    search_fields = ['comment']
    raw_id_fields = ['auditor']
    filter_horizontal = ['tags']

@admin.register(models.AuditRecord)
class AuditRecordAdmin(ModelAdmin):
    list_display = ['id', 'audit_management', 'auditor', 'status', 'created_at']
    list_display_links = ['id']
    list_select_related = ['audit_management', 'auditor']
    list_filter = ['status']
    search_fields = ['comment']
    raw_id_fields = ['auditor', 'audit_management']
